package example.demo.quartz.usespring;

import lombok.extern.slf4j.Slf4j;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Trigger;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;


@Component
@Slf4j
//@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class CustomerJobBean extends QuartzJobBean {
    /*QuartzJobBean的scope缺省是原型--即多例的*/
    public CustomerJobBean() {
//        log.info("CustomerJobBean extends QuartzJobBean-----------------CustomerJobBean构造器");
    }

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        Trigger trigger = jobExecutionContext.getTrigger();

        JobDetail jobDetail = jobExecutionContext.getJobDetail();
//        log.info("CustomerJobBean extends QuartzJobBean-----------------execute-job");
    }
}
